#!/usr/bin/python
# -*- coding: UTF-8 -*-
from selenium import webdriver

from com.test.combination.page import AccountManagerTest as pageAccountManager
from com.test.combination.api import AccountManagerTest as apiAccountManager

# 调度的入口类
class CloudAdminLoginMain:

    driver = webdriver.Chrome()

    print("API测试程序开始")
    testAccountInstance = pageAccountManager.AccountManagerTest(driver)
    print("测试错误账号登录")
    res = testAccountInstance.testErrorLogin()
    print("测试错误账号登录:" + (res.__str__() == "1").__str__())
    print("测试正确的账号登录")
    res == testAccountInstance.testLogin()
    print("测试正确账号登录:" + (res.__str__() == "1").__str__())

    # 接口测试
    res = apiAccountManager.AccountManagerTest.testLogin()
    if (res.json()['data']['customer']['token'] != None):
        print("接口登录成功,TOKEN:" + res.json()['data']['customer']['token'])
